package com.wenli.graduate2022.wenliGreenShop.service.servImpl;

import com.wenli.graduate2022.wenliGreenShop.entity.Admin;
import com.wenli.graduate2022.wenliGreenShop.repository.mapper.AdminMapper;
import com.wenli.graduate2022.wenliGreenShop.service.servDao.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author HuangHai
 * @date 2021/10/5 14:45
 */
@Service
public class AdminServImpl implements AdminService {

    @Autowired
    AdminMapper adminMapper;

    @Override
    public Admin adminLogin(String name,String psd ) {
        return adminMapper.adminLogin(name,psd);
    }

    @Override
    public Admin findById(Integer id) {
        return adminMapper.findById(id);
    }


    /**
     * 修改管理员密码,新密码封装在在Admin里，旧密码是String password
     * @param
     * @param id
     * @param password
     * @return
     */
    @Override
    public int updatePassword(Admin admin, Integer id, String password) {
        return adminMapper.updatePassword(admin,id,password);
    }
}
